﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace TradeSea
{
    // sadly syncing the world will not be needed, I can achieve the same effect by keeping the seed the same for the random number generator
    public class World
    {
        Vector3 wind;
        public static Random r = new Random();
        int interval = r.Next(100, 1000);

        public World()
        {
           wind = Vector3.Normalize(new Vector3(r.Next(-1,1), 0, 2)) * r.Next(8,18); // temp initial value
            
        }

        public void Update(GameTime time)
        {
            //creates new wind vector every time interval
            if (time.TotalGameTime.TotalSeconds >= interval)
            {
                wind = new Vector3(r.Next(-8, 8), 0, r.Next(-8, 8));
                interval = interval + r.Next(r.Next(1,1000), r.Next(1,1000));
            }
        }

        public Vector3 GetWind(Vector3 location)
        {
            return wind; //could be fetched from weather data based on location?
        }
        public float GetAirDensity(Vector3 location)
        {
            return 1.2f; //can be approximated for sea level using temperature data. equation pretty much linear
        }

        public void NewSeed(int seed)
        {
            r = new Random(seed);
            interval = r.Next(100, 1000);
        }

    }
}
